

<template>
  <div>
    <basic-container>
			<el-form style="margin-bottom: 0;">
				<el-form-item label="关键字" style="margin-bottom: 0;">
					<!-- <el-input v-model="keystr" placeholder="请输入客户名称客户、手机号码" size="small"/> -->				
					<el-input style="width:360px" placeholder="请输入客户名称客户、手机号码"  v-model="keystr">
						<el-button slot="append" icon="el-icon-search"  @click="btnSeach"></el-button>
					</el-input>
				</el-form-item>
				</el-form>
      <avue-crud :option="tableOption" :data="tableData" :table-loading="tableLoading" :page="page"  @search-change="searchChange" @refresh-change="handleList">
      </avue-crud>
    </basic-container>
  </div>
</template>

<script>
/* eslint-disable */
import { mapGetters } from "vuex";
import crudMixin from '@/mixins/crud'
import options from "./options.js";
import { isNull, arr2pojo, obj2pojo, validateResponse } from "@/util/util";
import { successMsg, errorMsg } from "@/util/message"
import { field, reField } from "./field";

export default {
  name: "role",
  mixins: [crudMixin],
  components: {
  },
  data() {
    return Object.assign({}, options, {
    })
  },
  created() {
    //初始化数据格式
    this.handleList();
  },
  watch: {},
  mounted() { },
  computed: {
  },
  props: [],
  methods: {
    handleList(form = {}) {
      this.tableLoading = true;

      var vm = this
      this.tableData = [];
      this.page.total = 0;
      this.tableLoading = false;
   
	    this.searchChange(form);
    },
		//查询按钮
		btnSeach:function(){
			this.page.currentPage = 1
			this.searchChange();
			},
		//查询
		searchChange(form){
					let params = Object.assign({}, form, {
						perPage: this.page.pageSize,
						page: this.page.currentPage,
						txtkey:this.keystr,
					});
				 
					 this.$store
					   .dispatch("GetUserList", params)
					   .then(
					     res => {
					       console.log(res)
					       this.tableLoading = false;
					       if (res.data.status == 1) {
					         let _data = res.data.result.data || []
					         let _meta = res.data.result.meta || []
			
					         this.tableData = _data;
					         this.page.total = _meta.total;
					       }
					     }, error => {
					       this.tableLoading = false;
					     })
        //this.$message.success('搜索数据'+ JSON.stringify(params));
      },
  }
};
</script>
